package com.example.demo.Controler;

import com.example.demo.vo.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author YaoZhidong
 * @version 1.0
 * @created 18-1-13
 */
@Controller
@RequestMapping(value = "")
public class DemoController {

    @GetMapping(value = "/test")
    public Object demo(String name) {
        return "/static/websocket.html";
    }

    @PostMapping(value = "/post")
    public Object demo(@RequestBody UserVO userVO) {
        System.out.println("请求到了@:" + userVO.toString());
        return "hello world!";
    }

    @GetMapping(value = "/index")
    public ModelAndView index() {
        ModelAndView modelAndView = new ModelAndView("index");
        modelAndView.addObject("hello word");
        return modelAndView;
    }
}
